package pers.kw.server.sentinel.controller.exception;

import com.alibaba.csp.sentinel.slots.block.BlockException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import pers.kw.protocol.R;

public class CommonException {

    private static final Logger log = LoggerFactory.getLogger(CommonException.class);

    public static R fallback(Integer id, Throwable e) {
        log.error("出现业务异常");
        return R.fail(-1, "===业务异常==");
    }

    public static R handleException(Integer id, BlockException e) {
        log.error("触发限流机制");
        return R.fail(-2, "====触发限流机制==");
    }
}
